home *** CD-ROM | disk | FTP | other *** search
- property pBeginLeaveTime, pTimeToLeave, pBeginRect, pLeaving, pBeginEntryTime, pBeginning, pReadyToBegin, pLeaveType, pLeaveTarget, pBeginType, pBeginTarget, pIntroTime, pFadeInTargetBlend, pBeginLeaveBlend
-
- on getPropertyDescriptionList me
- list = [:]
- addProp(list, #pLeaveType, [#comment: "Which type of leave?", #format: #symbol, #default: #fadeOut, #range: [#fadeOut, #fadeIn, #Animate, #nothing]])
- addProp(list, #pLeaveTarget, [#comment: "The Leave Target (blend % or rect)", #format: #string, #default: 0])
- addProp(list, #pBeginType, [#comment: "Which type of intro?", #format: #symbol, #default: #fadeIn, #range: [#fadeIn, #fadeOut, #nothing]])
- addProp(list, #pBeginTarget, [#comment: "The Begin Amount (blend %)", #format: #string, #default: 0])
- addProp(list, #pIntroTime, [#comment: "The Intro Time (milliseconds)", #format: #integer, #default: 750])
- return list
- end
-
- on LeaveThisFrame me, timeTilLeave
- if pLeaveType <> #nothing then
- pBeginLeaveTime = the milliSeconds
- pTimeToLeave = timeTilLeave
- pBeginLeaveBlend = sprite(me.spriteNum).blend
- pLeaving = 1
- end if
- end
-
- on beginSprite me
- pBeginLeaveTime = 0
- pBeginRect = sprite(me.spriteNum).rect
- if pBeginType <> #nothing then
- pReadyToBegin = 1
- if pBeginType = #fadeIn then
- pFadeInTargetBlend = sprite(me.spriteNum).blend
- sprite(me.spriteNum).blend = value(pBeginTarget)
- else
- if pBeginType = #fadeOut then
- sprite(me.spriteNum).blend = 100
- end if
- end if
- end if
- end
-
- on exitFrame me
- if pReadyToBegin then
- pReadyToBegin = 0
- pBeginEntryTime = the milliSeconds
- pBeginning = 1
- end if
- if pLeaving then
- percent = float(the milliSeconds - pBeginLeaveTime) / pTimeToLeave
- if percent > 1 then
- percent = 1.0
- end if
- if pLeaveType = #fadeOut then
- targetBlend = value(pLeaveTarget)
- amountToChange = (pBeginLeaveBlend - targetBlend) * percent
- sprite(me.spriteNum).blend = pBeginLeaveBlend - amountToChange
- else
- if pLeaveType = #fadeIn then
- targetBlend = 100
- amountToChange = (targetBlend - value(pLeaveTarget)) * percent
- sprite(me.spriteNum).blend = pBeginTarget + amountToChange
- else
- if pLeaveType = #Animate then
- currentRect = rect(0, 0, 0, 0)
- targetRect = value(pLeaveTarget)
- repeat with i = 1 to 4
- nextPoint = (pBeginRect[i] * (1.0 - percent)) + (targetRect[i] * percent)
- currentRect[i] = nextPoint
- end repeat
- sprite(me.spriteNum).rect = currentRect
- end if
- end if
- end if
- else
- if pBeginning then
- percent = float(the milliSeconds - pBeginEntryTime) / pIntroTime
- if percent > 1 then
- percent = 1.0
- pBeginning = 0
- end if
- if pBeginType = #fadeIn then
- targetBlend = pFadeInTargetBlend
- amountToChange = (targetBlend - value(pBeginTarget)) * percent
- sprite(me.spriteNum).blend = pBeginTarget + amountToChange
- else
- if pBeginType = #fadeOut then
- targetBlend = value(pBeginTarget)
- amountToChange = (100 - targetBlend) * percent
- sprite(me.spriteNum).blend = 100 - amountToChange
- end if
- end if
- end if
- end if
- end
-